package com.ibeetl.admin.aod.service;

import java.util.List;

import com.ibeetl.admin.aod.web.query.AodNumberAttributionQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.ibeetl.admin.aod.dao.AodNumberAttributionDao;
import com.ibeetl.admin.aod.entity.AodNumberAttribution;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 手机号码归属地 Service
 */

@Service
@Transactional
public class AodNumberAttributionService extends BaseService<AodNumberAttribution>{

    @Autowired
    protected AodNumberAttributionDao aodNumberAttributionDao;

    public PageQuery<AodNumberAttribution>queryByCondition(PageQuery query){
        PageQuery ret =  aodNumberAttributionDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelAodNumberAttribution(List<Long> ids){
        try {
            aodNumberAttributionDao.batchDelAodNumberAttributionByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除手机号码归属地失败", e);
        }
    }

    public List<AodNumberAttribution> queryAll(AodNumberAttributionQuery aodNumberAttributionQuery) {
        return aodNumberAttributionDao.queryAll(aodNumberAttributionQuery);
    }

}